package com.mapper;

import com.domain.Account;
import com.domain.User;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;

public interface AccountMapper {
   @Insert(" insert into account values(#{id},#{name},#{money},#{detail})")
    public void save(Account account);

    @Select(" select * from account")
    public List<Account> findAll();

    @Select("select *from account where id=#{id}")
    public Account findById(int id);

    //查询
 @Select("select *from account where  name=#{name}")
 public List<Account> findByIds(@Param("name")String name);

    @Delete("delete  from account where id=#{id}")
    public int deleteById(int id);

    @Update("update account set name=#{name},money=#{money},detail=#{detail} where  id=#{id}  ")
    public int updateAccount(Account account);


@Select("select *from users where username=#{username} and password=#{password}")
 public List<User> checkUser(@Param("username")String username, @Param("password")String password);

@Select("select *from users")
 public List<User> findUsers();


    @Delete("delete  from users where id=#{id}")
    public int deleteUserById(int id);

//注册页面
@Insert(" insert into users (username,password) values(#{username},#{password})")
   public void signUp(@Param("username")String username, @Param("password")String password);
}
